<?php
// create custom plugin settings menu
add_action('admin_menu', 'vps_create_menu');

function vps_create_menu() {

	$p = get_template_directory();

	//create new top-level menu
	add_theme_page('VPS Settings', 'VPS Settings', 'administrator', vps_settings, 'vps_settings_page');
	//add_submenu_page( vps_settings, 'General Settings', 'General', 'administrator', vps_gen_settings, 'vps_settings_page');
	add_action( 'admin_init', 'register_vpssettings' );
}

function register_vpssettings() {
	//register our settings
	register_setting( 'vps-settings-group', 'vps_parade_date' );
	register_setting( 'vps-settings-group', 'vps_general_email' );
	register_setting( 'vps-settings-group', 'vps_phone_number' );
	register_setting( 'vps-settings-group', 'vps_fax_number' );
	register_setting( 'vps-settings-group', 'vps_address_line1' );
	register_setting( 'vps-settings-group', 'vps_address_line2' );
	register_setting( 'vps-settings-group', 'vps_address_city' );
	register_setting( 'vps-settings-group', 'vps_address_prov' );
	register_setting( 'vps-settings-group', 'vps_address_code' );
	register_setting( 'vps-settings-group', 'vps_address_cntry' );
}

function vps_settings_page() { ?>
<div class="wrap">
	<?php if ( isset( $_GET['settings-updated'] ) && 'true' == esc_attr( $_GET['settings-updated'] ) )  {
			echo "<div id='message' class='updated'><p>", __("Settings Saved", "vps-options"), "</p></div>";
		}
	?>
<h2>Vancouver Pride Society General Settings</h2>
<form method="post" action="options.php">
<?php wp_nonce_field("vps-society-general-settings"); ?>
<?php settings_fields( 'vps-settings-group' ); ?>

<table class="form-table">

<tr valign="top">
<th scope="row">Pride Parade Date</th>
<td><input type="text" name="vps_parade_date" value="<?php echo get_option('vps_parade_date'); ?>" /> (YYYY-MM-DD)</td>
</tr>
</table>
<H3>Pride Contact Information</H3>
<table class="form-table">
<tr valign="top">
<th scope="row">Pride Email Address</th>
<td><input type="text" size="50px" name="vps_general_email" value="<?php echo get_option('vps_general_email'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Pride Phone Number</th>
<td><input type="text" size="50px" name="vps_phone_number" value="<?php echo get_option('vps_phone_number'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Pride Fax Number</th>
<td><input type="text" size="50px" name="vps_fax_number" value="<?php echo get_option('vps_fax_number'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Pride Address Line 1</th>
<td><input type="text" size="50px" name="vps_address_line1" value="<?php echo get_option('vps_address_line1'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Pride Address Line 2</th>
<td><input type="text" size="50px" name="vps_address_line2" value="<?php echo get_option('vps_address_line2'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Pride Address City</th>
<td><input type="text" size="50px" name="vps_address_city" value="<?php echo get_option('vps_address_city'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Pride Address Province</th>
<td><input type="text" size="50px" name="vps_address_prov" value="<?php echo get_option('vps_address_prov'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Pride Address Postal Code</th>
<td><input type="text" size="50px" name="vps_address_code" value="<?php echo get_option('vps_address_code'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Pride Address Country</th>
<td><input type="text" size="50px" name="vps_address_cntry" value="<?php echo get_option('vps_address_cntry'); ?>" /></td>
</tr>
</table>

<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>

</form>
</div>
<?php }

?>